home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / games / 36 / baspic.doc < prev    next >
Text File  |  1985-11-19  |  4KB  |  81 lines

  1.  
  2. Picture Show
  3. A picture loader for your ST BASIC programs.
  4.  
  5. by Mathew Spolin
  6.  
  7.  
  8.  One of the ST's most powerful features is its easily accessed graphics.
  9. Programs such as Neo-Chrome and DEGAS take full advantage of such graphics to
  10. create excellent picture files. But most people use the pictures they create
  11. only to impress friends and neighbors. Few actually use the pictures they draw
  12. within their own ST BASIC programs, because it's so difficult to load pictures
  13. from BASIC.
  14.  
  15.  Not any more. With the use of Picture Show's self-contained subroutine,
  16. SHOWPIC, loading NEO-Chrome or DEGAS pictures is as simple as defining a
  17. filename and calling the subroutine with a simple GOSUB.
  18.  
  19.  
  20. Using Picture Show.
  21.  
  22.  Use Xmodem to download Listing 1 from the database here on Delphi. If you're
  23. using the RAM version of TOS, you may need to disable buffered graphics in
  24. order to utilize the program. Lines 10-140 are part of the demo program driver
  25. and are not needed in order to use the subroutine. The actual Showpic
  26. subroutine begins at Line 64000.
  27.  
  28.  To use Picture Show within your own programs, combine the subroutine with your
  29. main program by using the MERGE command. Then, whenever you wish to display a
  30. picture, define FILE$ with the name of the picture you wish to display. The
  31. picture may be either NEO-Chrome or DEGAS, but don't forget to include the
  32. extension. Also, be sure the screen is in the same resolution mode as the
  33. picture you're attempting to load. If not, the picture won't appear clearly on
  34. the screen.
  35.  
  36.  Once the filename is defined, call the subroutine with a GOSUB SHOWPIC
  37. statement. The screen will clear, the mouse pointer will disappear, and your
  38. picture will be loaded into screen memory. The subroutine will then wait for
  39. the left mouse button to be pressed. When this happens, Picture Show will clear
  40. the screen, restore the mouse pointer and return control to the main program.
  41.  
  42.  
  43. How it works.
  44.  
  45.  Picture Show is a series of GEM and VDI calls, combined with a BLOAD command
  46. and some color palette handling code. In a nutshell, variables are defined and
  47. redimensioned in Lines 64010 and 64020. The color palette is then saved in the
  48. variable PAL% in Lines 64030 and 64040. Then, in Lines 64050 through 64070, the
  49. picture type is determined and variables are set as to the header lengths of
  50. the two types of pictures.
  51.  
  52.  The VDI routine Hide_Pointer, called at Line 64080, hides the mouse pointer so
  53. it won't spoil the picture. Then, at Lines 64090 through 64110, the new color
  54. palette is loaded in and changed. Line 64110 also calls a VDI routine called
  55. Clear_Workstation, which clears the entire screen, including the menu bar.
  56.  
  57.  This done, the actual picture is loaded into screen RAM at Line 64120. The AES
  58. routine, known as Mouse_Event, called at Line 64130, waits for the left mouse
  59. button to be pressed. The POKE statement at Line 64140 resets the palette to
  60. its original colors. At Line 64150, the screen is again cleared and, through
  61. Line 64160, the VDI routine Show_Mouse is called, which restores the pointer to
  62. the screen. Finally, Line 64170 sends control back to the main program.
  63.  
  64.  You may notice that, even though ST BASIC will redraw the windows, the menu
  65. bar remains blank and the menu still functions as usual. This is because,
  66. although AES routine Create_Menu (used to make all ST menu bars) draws and
  67. maintains a new menu, it never updates the menu bar. However, this has no
  68. effect on the menu functions.
  69.  
  70.  So, next time you need a really elaborate title page, or need to load a game
  71. background, utilize those stunning graphics available to your ST...from BASIC!
  72.  
  73.  
  74. Author's Biography:
  75.  
  76.  Mathew Spolin has been writing computer programs for six years and works in
  77. BASIC, Action!, C and 6502 assembly language. He currently enjoys writing
  78. programs on his 520ST, while his 130XE runs his bulletin board system, the
  79. Towers of Darkness BBS, at (301) 656-3401.
  80.  
  81. ə